package cn.bqjr.eily.web.exception.exclass;

import cn.bqjr.eily.web.exception.ExceptionMapping;

public abstract class BaseException extends RuntimeException {
    public BaseException() {
        super();
    }

    public BaseException(String msg) {
        super(msg);
    }

    public BaseException(String msg, Throwable cause) {
        super(msg, cause);
    }

    public BaseException(Throwable cause) {
        super(cause);
    }

    @Override
    public String getMessage() {
        ExceptionMapping mapping = getExceptionMapping();
        if (null == mapping) {
            return ExceptionMapping.DEFAUT_EXCEPTION.getErrorMsg();
        } else {
            return mapping.getErrorMsg() + ":" + super.getMessage();
        }
    }

    public abstract ExceptionMapping getExceptionMapping();
}
